package com.school.entity;


public class Student extends Person {
    private Course course;


    public Student(String id, String name, String gender) {
        super(id, name, gender);
    }


    @Override
    public void printWorksheet() {
        super.printWorksheet();
        System.out.println("身份: 学生");
        if (course != null) {
            System.out.println("所选课程: " + course.getName());
            System.out.println("上课地点: " + course.getLocation());
            System.out.println("上课时间: " + course.getTime());
            System.out.println("授课教师: " + course.getTeacher().getName());
        } else {
            System.out.println("暂无选课记录");
        }
        System.out.println("=============\n");
    }


    public void selectCourse(Course course) {
        this.course = course;
    }

    public void dropCourse() {
        this.course = null;
    }

    public Course getCourse() {
        return course;
    }
}